odoo.define('custom.audit.tree', function (require) {
    "use strict";
    var ListController = require('web.ListController');
    var ListView = require('web.ListView');
    var Session = require('web.session');
    var viewRegistry = require('web.view_registry');
    var AuditListController = ListController.extend({

        buttons_template: 'custom.audit.buttons',
        events: _.extend({}, ListController.prototype.events, {

            'click .o_button_audit': '_onButtonSend',
        }),
        _onButtonSend: function () {
            var self = this;
            self.session = Session;
            console.log(this.session);
            var records = _.map(self.selectedRecords, function (id) {
                return self.model.localData[id];
            });
            var ids = _.pluck(records, 'res_id');
            this._rpc({
                model: self.modelName,
                method: 'audit_btn',
                args: [ids],
            }).then(function () {
                 location.reload();
            });
            //
        }
    });
    var AuditListView = ListView.extend({
        config: _.extend({}, ListView.prototype.config, {
            Controller: AuditListController,
        }),
    });
    viewRegistry.add('custom_audit_tree', AuditListView);
});